package com.thor.palmmall.rest.hdmall.sales.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.hdmall.sales.HDMSalesInputQueryParam;
import com.thor.palmmall.rest.hdmall.sales.MSalesInputQueryParam;
/**
 * @author:liyang
 * @time:2017年7月25日 下午4:14:23
 * @since:1.0
 */
public class HDMSalesInputQueryParamConverter
    implements Converter<MSalesInputQueryParam, HDMSalesInputQueryParam> {
  public static HDMSalesInputQueryParamConverter getInstance() {
    if (instance == null)
      instance = new HDMSalesInputQueryParamConverter();
    return instance;
  }

  private static HDMSalesInputQueryParamConverter instance;

  private HDMSalesInputQueryParamConverter() {
  }

  @Override
  public HDMSalesInputQueryParam convert(MSalesInputQueryParam source) {

    if (source == null) {
      return null;
    }
    HDMSalesInputQueryParam dest = new HDMSalesInputQueryParam();
    dest.setContracts(source.getContracts());
    dest.setDateRange(HDMDateRangeConverter.getInstance().convert(source.getDateRange()));
    dest.setPage(source.getPage());
    dest.setPageSize(source.getPageSize());
    dest.setState(source.getState());
    return dest;
  }

}
